web3.js web3.utils.toHex
web3.utils.toHex(mixed)
ζΈ‘γγγε€γ16ι²ζ°ζεεγ«ε€ζγγΎγγ
ζ°ε€γ葨γζεεγ―ζ°ε€γ¨γγ¦γζεγ葨γζεεγ―UTF-8ζεεγ¨γγ¦ζ±γγγΎγγ
γγ©γ‘γΌγΏ
1. mixed - String|Number|BN|BigNumber
16ι²ζ°ζεεγ«ε€ζγγε€
ζ»γε€
String
16ι²ζ°ζεε
γ΅γ³γγ«
code:example.js
web3.utils.toHex('234');
"0xea"
web3.utils.toHex(234);
"0xea"
web3.utils.toHex(new BN('234'));
"0xea"
web3.utils.toHex(new BigNumber('234'));
"0xea"
web3.utils.toHex('I have 100β¬');
"0x49206861766520313030e282ac"
εθ